Xbasic

a5_xmlarguments_decode Function

Syntax

C a5_XMLArguments_decode(C encodedXML [,L flagIsUrlEncoded ])

Arguments

encodedXMLCharacter

String that was encoded using a5_XMLArguments_encode.

flagIsUrlEncodedCharacter

Default = .t.. Specifies whether or not the string is URL encoded.

Returns

resultCharacter

Returns the decoded XML arguments object.

Description

Takes an encoded XML Arguments string (created with a5_XMLArguments_encode()) and decodes it.

Example

dim args as SQL::Arguments
args.set("city","boston")
args.set("state","ma")

dim xml as c = args.XML
dim encoded as c =  a5_xmlarguments_encode(xml)
encoded = "http://www.mypage.com/somecallback.a5w?args="+encoded

? encoded
= "%3cN%3ecity%3c%2fN%3e%3cT%22C%22%3eboston%3c%2fT%3e%0d%0a%3cN%3estate%3c%2fN%3e%3cT%22C%22%3ema%3c%2fT%3e"

? a5_xmlarguments_decode(encoded)
= <SQLArguments>
<SQLArgument><Name>city</Name><Data Type="C">boston</Data></SQLArgument>
<SQLArgument><Name>state</Name><Data Type="C">ma</Data></SQLArgument></SQLArguments>

' URL Decoded Example:
dim encoded2 as c = urldecode(encoded)
? encoded2
= <N>city</N><T"C">boston</T>
<N>state</N><T"C">ma</T>

? a5_xmlarguments_decode(encoded2,.f.)
= <SQLArguments>
<SQLArgument><Name>city</Name><Data Type="C">boston</Data></SQLArgument>
<SQLArgument><Name>state</Name><Data Type="C">ma</Data></SQLArgument></SQLArguments>

Limitations

Internal Use Only